package com.obas.business.scriptmanagement.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ScriptStatement implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3293491064835548533L;

	private int command;

	private String appId;

	private long testcaseScriptId;

	private String method;

	private String automationName;

	// private String args;
	private ScriptVerification scriptVerification;

	private List<ScriptAtomationPart> scriptAtomationParts;

	private List<ScriptAtomationArg> scriptAtomationArgs;

	private int screenWidth;// pixel
	
	private int screenHeight;// pixel
	
	private byte[] screenshot;
	
	public ScriptStatement addScriptAtomationPart(ScriptAtomationPart scriptAtomationPart) {
		if (null != scriptAtomationPart) {
			if (null == scriptAtomationParts) {
				scriptAtomationParts = new ArrayList<ScriptAtomationPart>();
			}
			scriptAtomationParts.add(scriptAtomationPart);
		}
		return this;
	}

	public ScriptStatement addScriptAtomationArg(ScriptAtomationArg scriptAtomationArg) {
		if (null != scriptAtomationArg) {
			if (null == scriptAtomationArgs) {
				scriptAtomationArgs = new ArrayList<ScriptAtomationArg>();
			}
			scriptAtomationArgs.add(scriptAtomationArg);
		}
		return this;
	}

	public String getScriptAtomationArgString() {
		if (null != scriptAtomationArgs) {
			StringBuilder values = new StringBuilder();
			int len = scriptAtomationArgs.size();
			for (int i = 0; i < len; i++) {
				ScriptAtomationArg scriptAtomationArg = scriptAtomationArgs.get(i);
				values.append(scriptAtomationArg.getValue());
				if (i < len - 1) {
					values.append(",");
				}
			}
			return values.toString();
		}
		return null;
	}

	/**
	 * @return the scriptVerification
	 */
	public ScriptVerification getScriptVerification() {
		return scriptVerification;
	}

	/**
	 * @param scriptVerification
	 *            the scriptVerification to set
	 */
	public void setScriptVerification(ScriptVerification scriptVerification) {
		this.scriptVerification = scriptVerification;
	}

	/**
	 * @return the command
	 */
	public int getCommand() {
		return command;
	}

	/**
	 * @return the screenWidth
	 */
	public int getScreenWidth() {
		return screenWidth;
	}

	/**
	 * @param screenWidth the screenWidth to set
	 */
	public void setScreenWidth(int screenWidth) {
		this.screenWidth = screenWidth;
	}

	/**
	 * @return the screenHeight
	 */
	public int getScreenHeight() {
		return screenHeight;
	}

	/**
	 * @param screenHeight the screenHeight to set
	 */
	public void setScreenHeight(int screenHeight) {
		this.screenHeight = screenHeight;
	}

	/**
	 * @return the screenshot
	 */
	public byte[] getScreenshot() {
		return screenshot;
	}

	/**
	 * @param screenshot the screenshot to set
	 */
	public void setScreenshot(byte[] screenshot) {
		this.screenshot = screenshot;
	}

	/**
	 * @param command
	 *            the command to set
	 */
	public void setCommand(int command) {
		this.command = command;
	}

	/**
	 * @return the scriptAtomationArgs
	 */
	public List<ScriptAtomationArg> getScriptAtomationArgs() {
		return scriptAtomationArgs;
	}

	/**
	 * @param scriptAtomationArgs
	 *            the scriptAtomationArgs to set
	 */
	public void setScriptAtomationArgs(List<ScriptAtomationArg> scriptAtomationArgs) {
		this.scriptAtomationArgs = scriptAtomationArgs;
	}

	/**
	 * @return the scriptAtomationParts
	 */
	public List<ScriptAtomationPart> getScriptAtomationParts() {
		return scriptAtomationParts;
	}

	/**
	 * @param scriptAtomationParts
	 *            the scriptAtomationParts to set
	 */
	public void setScriptAtomationParts(List<ScriptAtomationPart> scriptAtomationParts) {
		this.scriptAtomationParts = scriptAtomationParts;
	}

	/**
	 * @return the testcaseScriptId
	 */
	public long getTestcaseScriptId() {
		return testcaseScriptId;
	}

	/**
	 * @param testcaseScriptId
	 *            the testcaseScriptId to set
	 */
	public void setTestcaseScriptId(long testcaseScriptId) {
		this.testcaseScriptId = testcaseScriptId;
	}

	/**
	 * @return the appId
	 */
	public String getAppId() {
		return appId;
	}

	/**
	 * @param appId
	 *            the appId to set
	 */
	public void setAppId(String appId) {
		this.appId = appId;
	}

	/**
	 * @return the automationName
	 */
	public String getAutomationName() {
		return automationName;
	}

	/**
	 * @param automationName
	 *            the automationName to set
	 */
	public void setAutomationName(String automationName) {
		this.automationName = automationName;
	}

	/**
	 * @return the method
	 */
	public String getMethod() {
		return method;
	}

	/**
	 * @param method
	 *            the method to set
	 */
	public void setMethod(String method) {
		this.method = method;
	}

}
